#!/usr/local/python/bin/python
# coding=utf-8
__author__ = 'Junjie.M'


class FileInfo():
    _data = []

    def setData(self, data):
        global _data
        _data = data

    def getAppCode(self):
        return _data['appCode']

    def getBizCode(self):
        return _data['bizCode']

    def getFileName(self):
        return _data['fileName']

    def getFilePath(self):
        return _data['filePath']

    def getFileType(self):
        return _data['fileType']

    def getTableName(self):
        return _data['tableName']

    def getZipType(self):
        return _data['zipType']

    # 是否支持压缩文件
    # return true:支持，false:不支持
    def isAllowZip(self):
        return _data['allowZip'] == '1'

    # 加载方式
    # return 1:增量，2：全量
    def getDataType(self):
        return _data['dataType']

    # 文件是否允许为空
    # return true:允许，false:不允许
    def isAllowNull(self):
        return _data['allowNull'] == '1'

    # 是否检查数据格式
    # return true:检查，false:不检查
    def isNeedDataCheck(self):
        return _data['needDataCheck'] == '1'

    # 字段分隔符
    def getColSeprator(self):
        if not _data['colSeprator']:
            return ''
        return _data['colSeprator']

    def getCheckType(self):
        return _data['checkType']

    def getStatus(self):
        return _data['status']

    def getHiveTableName(self):
        return _data['hiveTableName']

    def getImpalaTableName(self):
        return _data['impalaTableName']

    # def getFilePathType(self, default="txt"):
    #     return _data['filePathType'] if _data['filePathType'] else default

    def getFileNameType(self):
        return _data['fileNameType']

    # 是否本地转码
    # return true:本地转码，false:集群转码
    def isNeedEncoding(self):
        return _data['needEncoding'] == '1'

    def getSrcEncoding(self):
        return _data['srcEncoding']

    def getKeepDayNum(self):
        return _data['keepDayNum']

    def getKeepMonthNum(self):
        return _data['keepMonthNum']

    # 是否创建对应视图
    # return true:创建，false:不创建
    def getNeedView(self):
        return _data['needView'] == '1'

    # 文件名称分隔符
    def getFileSeprator(self):
        if not _data['fileSeprator']:
            return ''
        return _data['fileSeprator']

    # 文件名称后缀
    def getFileSuffix(self):
        if not _data['fileSuffix']:
            return ''
        return _data['fileSuffix']

    # 数据库编码
    def getDbCode(self):
        return _data['dbCode']

    # 数据文件类型
    def getDataFileType(self):
        return _data['dataFileType']
        
    # 源文件类型
    def getSrcFileType(self):
        return _data['srcFileType']

    # 指定读取文件行数
    def getReadLineNum(self):
        return _data['readLineNum']

    # 忽略末尾几行数据
    def getEndLineNum(self):
        return _data['endLineNum']
